<article id="wikiArticle">
<div></div>
<p>下面的内容是JavaScript 1.8.5的更新记录. 该版本已包含在<a href="/en-US/Firefox/Releases/4">Firefox 4</a>中.</p>
<h2 id="JavaScript_1.8.5的新特性">JavaScript 1.8.5的新特性</h2>
<h3 id="新函数">新函数</h3>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Function</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create" title="JavaScript/Reference/Global Objects/Object/Create">Object.create()</a></code></td>
<td>使用指定的原型对象和属性. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=492840" rel="noopener" title="FIXED: ES5: Implement Object.create">bug 492840</a></td>
</tr>
<tr>
<td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty" title="JavaScript/Reference/Global Objects/Object/DefineProperty">Object.defineProperty()</a></code></td>
<td><span style="background-color: rgba(212, 221, 228, 0.14902);">为对象添加给定的描述信息的</span>属性名.</td>
</tr>
<tr>
<td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties" title="JavaScript/Reference/Global Objects/Object/DefineProperties">Object.defineProperties()</a></code></td>
<td><span style="background-color: rgba(212, 221, 228, 0.14902);">为对象添加多个给定的描述信息的</span><span style="background-color: rgba(212, 221, 228, 0.14902);">属性名</span>.</td>
</tr>
<tr>
<td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor" title="JavaScript/Reference/Global Objects/Object/GetOwnPropertyDescriptor">Object.getOwnPropertyDescriptor()</a></code></td>
<td>返回对象的指定属性名的描述信息. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=505587" rel="noopener" title="FIXED: Implement ES5 Object.getOwnPropertyDescriptor">bug 505587</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys" title="JavaScript/Reference/Global Objects/Object/keys"><code>Object.keys()</code></a></td>
<td>返回由对象的所有可枚举属性组成的数组. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=307791" rel="noopener" title="FIXED: Implement ES5's Object.keys(O)">bug 307791</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames" title="JavaScript/Reference/Global Objects/Object/getOwnPropertyNames"><code>Object.getOwnPropertyNames()</code></a></td>
<td><span style="background-color: rgba(212, 221, 228, 0.14902);">返回由对象的所有可枚举和不可枚举属性组成的数组</span>. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=518663" rel="noopener" title="FIXED: ES5: Object.getOwnPropertyNames">bug 518663</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions" title="JavaScript/Reference/Global Objects/Object/preventExtensions"><code>Object.preventExtensions()</code></a></td>
<td>防止对象进行任意的扩展. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=492849" rel="noopener" title="FIXED: ES5: Implement Object.preventExtensions, Object.isExtensible">bug 492849</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible" title="JavaScript/Reference/Global Objects/Object/isExtensible"><code>Object.isExtensible()</code></a></td>
<td>判断对象是否可以扩展. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=492849" rel="noopener" title="FIXED: ES5: Implement Object.preventExtensions, Object.isExtensible">bug 492849</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal" title="JavaScript/Reference/Global Objects/Object/seal"><code>Object.seal()</code></a></td>
<td>防止其他代码删除对象的属性. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=492845" rel="noopener" title="FIXED: ES5: Implement Object.seal, Object.isSealed">bug 492845</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed" title="JavaScript/Reference/Global Objects/Object/isSealed"><code>Object.isSealed()</code></a></td>
<td>判断对象是否是密封<span style="background-color: rgba(212, 221, 228, 0.14902);">(即禁止删除属性)</span>的. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=492845" rel="noopener" title="FIXED: ES5: Implement Object.seal, Object.isSealed">bug 492845</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze" title="JavaScript/Reference/Global Objects/Object/freezed"><code>Object.freeze()</code></a></td>
<td>冻结一个对象: 其他代码不能删除或修改任何属性. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=492844" rel="noopener" title="FIXED: ES5: Implement Object.freeze, Object.isFrozen">bug 492844</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen" title="JavaScript/Reference/Global Objects/Object/isFrozen"><code>Object.isFrozen()</code></a></td>
<td>判断对象是否是冻结的. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=492844" rel="noopener" title="FIXED: ES5: Implement Object.freeze, Object.isFrozen">bug 492844</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray" title="JavaScript/Reference/Global Objects/Array/isArray"><code>Array.isArray()</code></a></td>
<td>判断变量是否是数组. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=510537" rel="noopener" title="FIXED: ES5: Array.isArray">bug 510537</a></td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toJSON" title="JavaScript/Reference/Global Objects/Date/toJSON"><code>Date.prototype.toJSON()</code></a></td>
<td>返回一个Date对象用JSON格式化的字符串.</td>
</tr>
<tr>
<td><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind" title="JavaScript/Reference/Global_Objects/Function/bind"><code>Function.prototype.bind()</code></a></td>
<td><span style="background-color: rgba(212, 221, 228, 0.14902);">创建一个新函数,当这个函数被调用时,函数会使用提供的上下文环境(给定的字符序列) <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=429507" rel="noopener" title="FIXED: Function.prototype.bind">bug 429507</a></span></td>
</tr>
</tbody>
</table>
<h3 id="ECMAScript5新特性">ECMAScript5新特性</h3>
<ul>
<li><code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/get" title="JavaScript/Reference/Operators/Special Operators/get Operator">get</a></code> 和 <code><a href="/en-US/docs/Web/JavaScript/Reference/Operators/set" title="JavaScript/Reference/Operators/Special Operators/set Operator">set</a></code> 操作现在允许标识为数值或字符串. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=520696" rel="noopener" title='FIXED: Implement support for |{ get "string literal"() { /* ... */ }, get 5.4() { /* ... */ }, 6.72: 3 }|'>bug 520696</a></li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply" title="JavaScript/Reference/Global Objects/Function/apply"><code>Function.apply()</code></a> 能接受任意的类数组的对象作为参数列表,而不是只支持真正数组.</li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode" title="JavaScript/Strict mode">支持严格 模式</a></li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString" title="JavaScript/Reference/Global Objects/Array/toString"><code>Array.toString()</code></a> 现在允许在非数组上使用,如果允许则会返回调用其 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join" title="JavaScript/Reference/Global Objects/Array/join"><code>join()</code></a> 方法,否则调用 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString" title="JavaScript/Reference/Global Objects/Object/toString"><code>toString()</code></a> 方法.</li>
</ul>
<h3 id="其他标准化的工作">其他标准化的工作</h3>
<p>删除一些定义getters和setters的非标准化语法; ECMAScript 5 定义的语法没有变化. 这些语法很难懂且很少被使用; 如果这个影响到你, 详细内容请看 <a class="external" href="http://whereswalden.com/2010/04/16/more-spidermonkey-changes-ancient-esoteric-very-rarely-used-syntax-for-creating-getters-and-setters-is-being-removed/" rel="noopener" title="http://whereswalden.com/2010/04/16/more-spidermonkey-changes-ancient-esoteric-very-rarely-used-syntax-for-creating-getters-and-setters-is-being-removed/">这篇博客</a>.</p>
<h3 id="新对象">新对象</h3>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Object</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Proxy">Proxy</a></code></td>
<td>提供创建对象和函数的代理,以在Javascript中支持元编程.</td>
</tr>
</tbody>
</table>
<h2 id="JavaScript_1.8.5中功能变化">JavaScript 1.8.5中功能变化</h2>
<ul>
<li>ISO 8601 在Date中支持<code>: </code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date">Date</a> 对象的 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/parse">parse()</a> 方法现在支持简单的ISO 8601 格式化时间字符串.</li>
<li>全局对象变为只读: 按照ECMAScript 5 标准,<a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN" title="JavaScript/Reference/Global Objects/NaN"><code>NaN</code></a>, <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity" title="JavaScript/Reference/Global Objects/Infinity"><code>Infinity</code></a>, 和 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined" title="JavaScript/Reference/Global Objects/undefined"><code>undefined</code></a> 全局对象变为只读.</li>
<li><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/Parent" title="JavaScript/Reference/Global Objects/Object/Parent"><code>obj.__parent__</code></a> and <code>obj.__count__</code> 过时. 部分原因如下:: <a class="external" href="http://whereswalden.com/2010/05/07/spidermonkey-change-du-jour-the-special-__parent__-property-has-been-removed/" rel="noopener" title="http://whereswalden.com/2010/05/07/spidermonkey-change-du-jour-the-special-__parent__-property-has-been-removed/">SpiderMonkey change du jour: the special __parent__ property has been removed</a> <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=551529" rel="noopener" title="FIXED: Remove __count__">bug 551529</a> &amp; <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=552560" rel="noopener" title="FIXED: Remove __parent__">bug 552560</a>.</li>
<li><code><a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse" title="Using native JSON">JSON.parse()</a>不再支持逗号结尾</code>.</li>
</ul>
</article>